<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!-- <iframe style=" display: none;width:100%; height:100%;position:absolute; left:0;top:0;z-index:-88888;background: transparent;filter:alpha(opacity=0);  
      -moz-opacity:0;  
      -khtml-opacity:0;  
      opacity:0; " id="DevWinFrame" name="submitFramexs" class="submitFramexs" frameborder="no"> </iframe> -->
<div id="SaveOrUpdateDevWin2"
	style="width: 700px; height: 380px; padding: 10px;overflow-y: auto;"
	class="easyui-dialog" title="查询录入操作"
	data-options="modal:true,closed:true,minimizable:false,collapsible:false,maximizable:false,buttons:'#bb',iconCls:'icon-save',onClose:function(){$('#saveOrUpdateDevForm2')[0].reset();} ">
	<form id="saveOrUpdateDevForm2" method="post" enctype="multipart/form-data" >
		<div class="menu_form_body">
		    <input type="hidden" id="lrglbm" name="glbm"/>
		    <input type="hidden" id="lrxzqh" name="xzqh"/>
			<table name="hphm" border="0" cellpadding="0" cellspacing="0" width="100%" class="cheliangxinxi">
				<tr>
					<th align="right" width="92" height="40">流水号：</th>
					<td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrlsh" name="lsh"  class="shurukuangkais" style=" margin: 0 0 0 10px;"/>
						<!-- <input id="SelectIds" class="easyui-combobox" style="width:80px" required="required"/> -->
						<input type="text" id="SelectIds" class="easyui-combobox" style="width:80px" required="required" value='2'/>
					</td>
					<th align="right" width="92" height="40">序号：</th>
					<td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrxh" name="xh"  class="shurukuangkais"  style=" margin: 0 0 0 10px;" />
					</td>
				</tr>
				<tr>
				    <th align="right" height="40">号牌号码：</th>
					<td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrhphmmc" name="hphmmc"  class="shurukuangkais"   style=" margin: 0 0 0 10px;" required="required"/>
					</td>
				    <th align="right" height="40">号牌种类：</th>
					<td class="tangchukuangliebiao1">
					 <input type="text" id="lrhpzlmc" name="hpzl" class="easyui-combobox shurukuangkais"  style=" margin: 0 0 0 10px;" required="required"/>
					</td>					
			    </tr>
				<tr>
				    <th align="right" height="40">业务类型：</th>
				    <td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrywlx" name="ywlx" class="easyui-combobox shurukuangkais"  style=" margin: 0 0 0 10px;" required="required"/>
					</td>
				    <th align="right">业务原因：</th>
				    <td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrywyy" name="ywyy" class="easyui-combobox shurukuangkais"  style=" margin: 0 0 0 10px;" required="required"/>
					</td>
					
				</tr>
		
			    <tr>
			        <th align="right" height="40">车辆品牌：</th>
				    <td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrclpp1" name="clpp1"  class="shurukuangkais" style=" margin: 0 0 0 10px;" required="required"/>
					</td>
					<th align="right">办结日期：</th>
				    <td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrbjrq" name="bjrq" class="easyui-datebox shurukuangkais"  style=" margin: 0 0 0 10px;"/>
					</td>					
					
				</tr>
				<tr>
				    <th align="right" height="40">车辆识别代号：</th>
				    <td align="left" class="tangchukuangliebiao1">
						<input type="text" id="lrclsbdh" name="clsbdh"  class="shurukuangkais"   style=" margin: 0 0 0 10px;" required="required"/>
					</td>
					<th align="right">档案编号：</th>
				    <td align="left"class="tangchukuangliebiao1">
						<input type="text" id="lrdabh" name="dabh"  class="shurukuangkais"   style=" margin: 0 0 0 10px;"/>
					</td>
				</tr>
				<tr>
				<th align="right" height="40">所有人：</th>
				    <td align="left" class="tangchukuangliebiao1" colspan="3">
						<input type="text" id="lrsyr" name="syr"  class="shurukuangkais"   style=" margin: 0 0 0 10px; width: 498px" required="required"/>
					</td>
			    </tr>
			    <tr>
			</table>
		</div>
	</form>
	<iframe id="iframe1" src="about:blank" frameBorder="0" marginHeight="0" marginWidth="0" style="position:absolute; visibility:inherit; top:0px;left:0px;width:700px; height:380px;z-index:-1; filter:alpha(opacity=0);"></iframe>
</div>
 <div id="bb">
	<a href="javascript:insertFuncNotFlow()" class="easyui-linkbutton">确认</a>
	<a href="javascript:cancelUpdateDev()" class="easyui-linkbutton">取消</a>
</div> 
<script type="text/javascript">

$(function(){

	//initSelect('lrhpzlmc','请选择号牌种类','dmz','dmsm1','${ctx}/code/findHpzl.htm');
	$("#SelectIds").combobox({
		prompt:'有无流水',
		editable:false,
		valueField: 'id',
		textField: 'text',
        panelHeight:'auto',
	    data:[{
	    	"id":"1",
	        "text":"有流水号"
	    },{
	        "id":"2",
	        "text":"无流水号"
	    }]
	});
	$("#lrhpzlmc").combobox({
		prompt:'请选择号牌种类',
		editable:false,
		valueField:'dmz',
        textField:'dmsm1',
        panelHeight:'180',
	    url:'${ctx}/code/findHpzl.htm'
	})
/* 	$("#SelectIds").combobox({
		prompt:'有无流水',
		editable:false,
		valueField:'dmz',
        textField:'dmsm1',
        panelHeight:'auto',
	    url:'${ctx}/code/findCodeByCodetype.htm?xtlb=11&dmlb=0000'
	}) */
	
	$("#lrywlx").combobox({
		prompt:'请选择业务类型',
		disabled: false,
		editable:false,
		valueField:'ywlx',
        textField:'ywlxmc',
	    url:'${ctx}/yxxx/queryYwlx.htm',
	    onSelect: function (record) {//联动
	    	$("#lrywyy").combobox({
	    		prompt:'请选择业务原因',
	            disabled: false,
	            editable:false,
	            url: '${ctx}/yxxx/queryYwyy.htm?ywlx=' + record.ywlx,
	            valueField: 'ywyy',
	            textField: 'ywmc'
	        }).combobox('clear');
	    }   
	});
})

//获取当前行所有的值
function insertFuncNotFlow(){
	debugger;
    v_lsh=$.trim($('#lrlsh').val());
	v_xh=$.trim($('#lrxh').val());
	$.ajax({
          type:'post',
          url:'${ctx}/yxxx/queryVehcileIsNot.htm',
          data:{
              lsh:v_lsh,
              xh:v_xh
          },
          dataType:'json',
          success:function(data){
        	if(data=="true" || data==true){
        		alert("当前记录已录入档案！");
        	    return ;
        	}
        	 var hphm=$.trim($('#lrhphmmc').val());//号牌号码
  		     var reg = /[\u4e00-\u9fa5]/g;//筛选是否有中文
  		     hphm = hphm.replace(reg, "");
        	 var _lsh = $.trim($('#lrlsh').val());
        	 var _xh = $.trim($('#lrxh').val());
        	 var _ywlx=$('#lrywlx').combobox('getValue');
        	 if($('#SelectIds').combobox('getValue')=='') {
        		 alert("请选择有无流水选项！");
        		 return;
        	 }
        	 if(($('#SelectIds').combobox('getValue')=='' && $.trim($('#lrlsh').val())!="") ||
        			 ($('#SelectIds').combobox('getValue')=='2' && $.trim($('#lrlsh').val())!="")) {
        		 alert("流水号和是否有流水选项不符！");
        		 return;
        	 }
        	 if($('#SelectIds').combobox('getValue')=='1'){
	        	 if($.trim($('#lrlsh').val())=="" || $.trim($('#lrxh').val())=="" || $('#lrywlx').combobox('getValue')=="" ||
	        			 $.trim($('#lrhpzlmc').combobox('getValue'))=="" || $.trim($('#lrclsbdh').val())=="" || $.trim($('#lrsyr').val())=="" ||
	        			 $('#lrywlx').combobox('getValue')=="" || $('#lrywyy').combobox('getValue')==""){
	        		 alert("有空值！请确认是否填写正确");
	        		 return;
        	 }
        	 }else{
        		 if($.trim($('#lrxh').val())=="" || $('#lrywlx').combobox('getValue')=="" ||
            			 $.trim($('#lrhpzlmc').combobox('getValue'))=="" || $.trim($('#lrclsbdh').val())=="" || $.trim($('#lrsyr').val())=="" ||
            			 $('#lrywlx').combobox('getValue')=="" || $('#lrywyy').combobox('getValue')==""){
            		 alert("有空值！请确认是否填写正确");
            		 return;
            	 } 
        	 }
       		   $('#lshFlag').val($.trim($('#lrlsh').val()));
       		   $('#xhFlag').val($.trim($('#lrxh').val()));
       		   $('#hphmFlag').val($.trim(hphm));
       		   $('#hpzlFlag').val($.trim($('#lrhpzlmc').combobox('getValue')));		            	   
       		   $('#clpp1Flag').val($.trim($('#lrclpp1').val()));
       		   $('#clsbdhFlag').val($.trim($('#lrclsbdh').val()));
       		   $('#fdjhFlag').val('');
       		   $('#csysFlag').val('');
       		   $('#syrFlag').val($.trim($('#lrsyr').val()));
       		   $('#fzjgFlag').val('');                
       		   $('#glbmFlag').val($.trim($('#lrglbm').val()));
       		   $('#xzqhFlag').val($.trim($('#lrxzqh').val()));
       		   $('#ywlxFlag').val($.trim($('#lrywlx').combobox('getValue')));
       		   $('#ywyyFlag').val($.trim($('#lrywyy').combobox('getValue')));
       		   $('#bjrqFlag').val($.trim($("#lrbjrq").datebox("getValue")));
       		   $('#dabhFlag').val($.trim($('#lrdabh').val()));
       		   $('#ywmcFlag').val($.trim($('#lrywyy').combobox('getText')));
       		   
       		    $('#lsh').text($('#lrlsh').val());
       			$('#hphmmc').text($('#lrhphmmc').val());
       			$('#hpzlmc').text($('#lrhpzlmc').combobox('getText'));
       			$('#clpp1').text($('#lrclpp1').val());
       			$('#syr').text($('#lrsyr').val());
       			$('#clsbdh').text($('#lrclsbdh').val());
       			$('#ywmc').text($('#lrywyy').combobox('getText'));
       			
       			$('#SaveOrUpdateDevWin2').window('close');
       			//显示当前业务档案类型
       			if(_ywlx=='A'){
       				$('#PcPoPmarket').show();
       				$("#lmt div[class='middle']").each(function (){
           				this.style.display="none";
           			});
       				$('#AAA').show();
       			}else if(_ywlx=='B'){
       				$('#PcPoPmarket').show();
       				$("#lmt div[class='middle']").each(function (){
           				this.style.display="none";
           			});
       				$('#BBB').show();
       			}else if(_ywlx=='D' || _ywlx=='K' || _ywlx=='L'){
       				$('#PcPoPmarket').show();
       				$("#lmt div[class='middle']").each(function (){
           				this.style.display="none";
           			});
       				$('#DDD').show();
       			}else if(_ywlx=='E'){
       				$('#PcPoPmarket').show();
       				$("#lmt div[class='middle']").each(function (){
           				this.style.display="none";
           			});
       				$('#EEE').show();
       			}else if(_ywlx=='G'){
       				$('#PcPoPmarket').show();
       				$("#lmt div[class='middle']").each(function (){
           				this.style.display="none";
           			});
       				$('#GGG').show();
       			}else if(_ywlx=='I'){
       				$('#PcPoPmarket').show();
       				$("#lmt div[class='middle']").each(function (){
           				this.style.display="none";
           			});
       				$('#III').show();
        		}else if(_ywlx=='S'){
       				$('#PcPoPmarket').show();
       				$("#lmt div[class='middle']").each(function (){
           				this.style.display="none";
           			});
       				$('#SSS').show();
        		}
          }
	})
}

//取消
function cancelUpdateDev(){
	$("#saveOrUpdateDevForm2")[0].reset();
	$("#SaveOrUpdateDevWin2").window("close");
}
</script>